package com.yanqu.road.server.cmd.activity.springdinner;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.activity.SpringDinnerProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.user.CrossUserMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C2_SPRINGDINNER_ACTIVITY_USER_BASE_INFO, desc = "更新基础信息")
public class CrossSpringDinnerUserBaseInfoCmd extends CrossCommand {

    private Long userId;

    private UserBaseInfo userBaseInfo;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        SpringDinnerProto.CrossUpdateUserBaseInfoReqMsg reqMsg = SpringDinnerProto.CrossUpdateUserBaseInfoReqMsg.parseFrom(packet.getBytes());
        userId = reqMsg.getUserId();
        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(reqMsg.getPlayerBaseData());
        CrossUserMgr.updateUserBaseInfo(userId,userBaseInfo);
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }

}
